It looks like you are not doing anything with the received data. All you are sending is the "GetStatus" command.
/// Makes the call to update the shared MAIN_STATUS structure
/// </summary>
public void UpdateMainStatus()
"GetStatus");
#endregion
How did you imagine the data was getting from KFLOP to the PC? :} Or am I missing something? When KFLOP receives this it will send back about 400 bytes of hexidecimal data which represents the binary image of the data structure. It is the application's responsibility to receive this data and place it (overlay it) into the MainStatus structure. Hmm C# proably won't like us doing stuff like that. KMotion does it in the function:
CKMotionCNCDlg::GetStatus()
Maybe we should duplicate (or move it) into KMotionDLL or KMotion_dotNet_Interop.
Also this function assumes that the Token has been obtained so the command and many lines of data will all come back to this Thread/Process/Code.
From: bradodarb <bradodarb@...>
To: DynoMotion@yahoogroups.com
Sent: Tuesday, December 6, 2011 8:45 PM
Subject: [DynoMotion] Re: MAIN_STATUS .net
Oops, forgot to mention I uploaded KMotion_dotNet
Here::
http://sourceforge.net/projects/cnctw/files/DynoMotion%20c%23/KMotion_dotNet.zip/download
-Brad Murry
--- In DynoMotion@yahoogroups.com, "bradodarb" <bradodarb@...> wrote:
>
> I've added interop members to access the MAIN_STATUS structure in the .net dlls
>
> It is not quite right(or at all). I must not be initializing something right, When I try to read bitstate::
>
> int bank = 0;
> if (index > 31)
> {
> bank = 1;
> index -= 31;
> }
> int retval = MainStatus.BitsState[bank] & (1<<index);
> return retval;
>
> It always returns false, even when I toggle the bits in KMotion. In fact, MainStatus.BitsState always contains [0,0]...
>
>
> To test things out I put this in the c# console app::
>
> _Controller.UpdateMainStatus();
> while (true)
> {
> var val = _Controller.MainStatus.GetBitsState(47);
>
> Console.WriteLine(val.ToString());
>
> Thread.Sleep(500);
> _Controller.UpdateMainStatus();
> }
>
>
> Am I missing something here?
>
>
> -Brad
>